<?php
	require_once "db_connection.php";
	$sql=mysql_query("SELECT 
						affiliate.affiliateid,
						affiliate.companyname,
						vehicles.vehicleid,
						vehicles.vehicletype,
						vehicles.capacity,
						onewayrate.vehiclemodel,
						onewayrate.distance,
						onewayrate.rate,
						onewayrate.affiliateid
						FROM
						onewayrate
						INNER JOIN affiliate ON affiliate.affiliateid = onewayrate.affiliateid
						INNER JOIN vehicles ON vehicles.vehiclemodel = onewayrate.vehiclemodel
						ORDER BY affiliate.companyname, vehicles.vehicletype, onewayrate.rate");

	$acc_num = 0;
	$class_alternate = "";
	while($row = mysql_fetch_array($sql)){
		$acc_num=$acc_num+1;
		echo"<tr class='". $class_alternate ."'>
						<td>".$acc_num."</td>
						<td>".$row['companyname']."</td>
						<td>".$row['vehicletype']."</td>
						<td>".$row['vehiclemodel']."</td>
						<td align='center'>".$row['capacity']."</td>
						<td>".$row['distance']."</td>
						<td align='right'>".$row['rate']."</td>	
						<td class='options-width'>
							<a href='edit.php?id=".$row['affiliateid']."' title='Edit' class='icon-1 info-tooltip'></a>
							<a href='delete_affiliate.php?id=".$row['affiliateid']."'  title='Delete' class='icon-2 info-tooltip'></a>
							<a href='view_affiliate.php?id=".$row['affiliateid']."' title='View' class='icon-5 info-tooltip'></a>
						</td>
					</tr> ";
		if($class_alternate==""){ $class_alternate="alternate-row";}
		else{$class_alternate="";}				
	}
?>
